package com.kadron.itemtype;

import com.kadron.datamodel.KModel;
import com.kadron.entity.ItemType;
import com.kadron.entity.KItemImage;

public class KItemTypeModel implements KModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7218072276994234886L;
	
	private ItemType itemType;
	private KItemImage img;
	
	public KItemTypeModel(ItemType itemType, KItemImage image) {
		super();
		this.itemType = itemType;
		this.img = image;
	}

	@Override
	public long getId() {
		return itemType.getId();
	}

	public ItemType getItemType() {
		return itemType;
	}

	public void setItemType(ItemType itemType) {
		this.itemType = itemType;
	}

	public KItemImage getImg() {
		return img;
	}

	public void setImg(KItemImage image) {
		this.img = image;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (itemType.getId() ^ (itemType.getId() >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		KItemTypeModel other = (KItemTypeModel) obj;
		if (itemType.getId() != other.itemType.getId())
			return false;
		return true;
	}
	
}
